package com.dht.app

import android.content.Context
import android.net.Uri
import android.view.LayoutInflater
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder


data class ImageResult(val path: Uri)
class ImageResultAdapter : BaseQuickAdapter<ImageResult, QuickViewHolder>() {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: ImageResult?) {
        item?.let {
            Glide.with(context).load(item.path).into(holder.getView(R.id.imageView))
        }
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        val view = LayoutInflater.from(context).inflate(R.layout.item_image_result, null, false)
        return QuickViewHolder(view)
    }
}